<?php
/**
 * Created by PhpStorm.
 * User: Hasee
 * Date: 2020/3/25
 * Time: 15:22
 */

function one(){
    echo "esfgs";
}

function template($name,$default='default')
{
    $url=WEB_ROOT."/template/$default/$name.html";
    tmp_val("$name"."CSS",CSS($name,$default));
    if (file_exists($url))
    {
        include_once $url;
    }
}
function tmp_val($name,$val)
{
    if (empty($GLOBALS['tmp_val']))//空的符合ture
    {
        $GLOBALS['tmp_val']=array();
    }
    $GLOBALS['tmp_val'][$name]=$val;

}
function CSS($name,$default)
{
    $time=time();
    return "<link rel=\"stylesheet\" href=\"/static/css/$default/$name.css?$time\">";
}
function JS($name,$default)
{
    $time=time();
    return "<script src=\"/static/js/$default/$name.js?$time\" type=\"text/javascript\" charset=\"utf-8\"></script>";
}
function JSON($code,$info,$data=array())
{
    $arr=array(
        'status'=>array(
            'code'=>$code,
            'info'=>$info,
        ),
        'data'=>$data
    );
    echo json_encode($arr);
}